<%@ page import="com.walkingfiles.registry.File" %>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'document', 'error')} required">
	<label for="document">
		<g:message code="file.document.label" default="Document" />
	</label>
	<g:if test="${documentInstance}">
		<g:hiddenField name="document.id" value="${documentInstance.id}"/>
		<span id="document"><g:link controller="document" action="show" id="${documentInstance?.id}">${documentInstance.number.encodeAsHTML() }: ${documentInstance.description.encodeAsHTML()}</g:link></span>
	</g:if>
	
</div>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'name', 'error')} required">
	<label for="created">
		<g:message code="file.name.label" default="Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="name" value="${fileInstance?.name}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'type', 'error')} required">
	<label for="type">
		<g:message code="file.type.label" default="Type" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="type" name="type.id" from="${com.walkingfiles.registry.FileType.list()}" optionKey="id" optionValue="name" required="" value="${fileInstance?.type?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'created', 'error')} required">
	<label for="created">
		<g:message code="file.created.label" default="Created" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="created" precision="day"  value="${fileInstance?.created}"  />
</div>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'data', 'error')} required">
	<label for="data">
		<g:message code="file.data.label" default="Data" />
		<span class="required-indicator">*</span>
	</label>
	<input type="file" id="data" name="data" />
</div>

<div class="fieldcontain ${hasErrors(bean: fileInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="file.description.label" default="Description" />
	</label>
	<g:textArea name="description" value="${fileInstance?.description}"/>
</div>
